<?php
//api模块路由


use think\facade\Route;


/**
 * 门店
 * */
Route::group('offline_store',function (){
    Route::post('apply_store','offline_store.store/applyShop');
    Route::post('edit_store','offline_store.store/editShop');//修改店铺
    Route::get('shop_info','offline_store.store/shopInfo');
    Route::get('category','offline_store.storel/storeCategory');//商圈分类列表
    Route::get('offline_shops','offline_store.storel/offlineShops');//商圈列表
    Route::post('add_goods','offline_store.store/addGoods');//新增商品
    Route::post('edit_goods','offline_store.store/editGoods');//编辑商品
    Route::post('del_goods','offline_store.store/delGoods');//删除商品
    Route::get('goods_list','offline_store.store/goodsList');//商品列表

    
    Route::get('offline_shops_info','offline_store.storel/shopInfo');//店铺信息
    Route::get('other_goods_list','offline_store.storel/goodsList');//商品列表
    Route::get('stores_modify_record','offline_store.store/storesModifyRecord');//店铺修改记录
    
    Route::get('lable','offline_store.storel/label');//标签列表
    // Route::get('coupon','market.coupon/index');
    // Route::get('combo','market.combo/index');
    // Route::post('combo/buy','market.combo/buy')->middleware(\app\api\middleware\AuthJwt::class);

});

/**
 * 用户路由
 * */
Route::group('user',function (){
    Route::post('bind_phone','user.user/bindPhone')->middleware(\app\api\middleware\AuthJwt::class);//绑定手机号
    Route::post('forget_password','user.user/forgetPassword');//忘记密码
    Route::post('modify_password','user.user/modifyPassword')->middleware(\app\api\middleware\AuthJwt::class);//修改密码
    Route::post('phone_login','user.user/phoneCodeLogin');//手机号验证码登录
    Route::post('register','user.user/register');
    Route::post('login','user.user/login');
    Route::post('sms','user.user/sms');
    Route::post('auth_sms','user.user/authSms')->middleware(\app\api\middleware\AuthJwt::class);//登录下的发送验证码
    
    Route::post('add_label','user.address/addLabel');//添加标签
    Route::post('del_label','user.address/delLabel');//删除标签

    Route::get('address','user.address/index');
    Route::get('lable_list','user.address/lableList');//地址标签
    Route::get('address/read','user.address/read');
    Route::post('address/save','user.address/save');
    Route::post('address/update','user.address/update');
    Route::get('address/delete','user.address/delete');
    Route::post('info/change','user.info/change');
    Route::post('add_user_ship','user.info/addUserShip');
    Route::post('info/upload','index/upload');
    Route::get('info/total','user.info/total');
    Route::get('info/balance','user.info/balance');
    Route::get('info/integral','user.info/integral');
    Route::get('info/gold','user.info/gold');
    Route::get('resell','user.resell/index');
    Route::get('resell/receive','user.resell/receive');
    Route::get('resell/sponsor','user.resell/sponsor');
    Route::get('repository','user.repository/index');

    /**
     * 商品收藏
     * */
    Route::get('collect/goods','user.CollectGoods/index');
    Route::post('collect/goods/save','user.CollectGoods/save');
    Route::post('collect/goods/delete','user.CollectGoods/delete');

    /**
     * 拼团商品收藏
     * */
    Route::get('collect/group/goods','user.CollectGroupGoods/index');
    Route::post('collect/group/goods/save','user.CollectGroupGoods/save');
    Route::post('collect/group/goods/delete','user.CollectGroupGoods/delete');

    /**
     * 我的任务
     * */
    Route::group('task',function (){
        Route::get('/','user.task/index');
        Route::get('receive','user.task/receive');
        Route::get('total','user.task/total');
    });

    /**
     * 兑换金豆
     * */
    Route::post('gold/redeem','user.gold/redeem');
    /**
     * 兑换余额
     * */
    Route::post('balance/redeem','user.balance/redeem');

    /**
     * 优惠券
     * */
    Route::group('coupon',function (){
        Route::get('/','user.coupon/index');
        Route::post('redeem','user.coupon/redeem');
    });

    /**
     * 签到
     * */
    Route::group('sign',function (){
        Route::post('save','user.sign/save');
    });




});

/**
 * 营销路由
 * */
Route::group('market',function (){
    Route::get('task','market.task/index');
    Route::get('coupon','market.coupon/index');
    Route::get('combo','market.combo/index');
    Route::post('combo/buy','market.combo/buy')->middleware(\app\api\middleware\AuthJwt::class);

});

/**
 * 收藏商品
 * */
Route::group('collect',function (){
    Route::get('goods/save','collect.goods/save');
    Route::get('group/goods/save','collect.goods/save');
});

/**
 * 拼团路由
 * */
Route::group('group',function (){
    Route::get('activity','group.activity/index');
    Route::get('activity/goods','group.activity/goods');
    Route::get('activity/goods/read','group.activity/read');
    Route::get('order','group.order/index');
    Route::get('order/read','group.order/read');
    Route::post('order/save','group.order/save');
    Route::post('order/trade/wx/notify','group.trade/wxNotify');
    Route::post('order/trade/ali/notify','group.trade/aliNotify');
    Route::post('order/finish/trade/wx/notify','group.trade/wxFinishNotify');
    Route::post('order/finish/trade/ali/notify','group.trade/aliFinishNotify');
});

/**
 * 秒杀路由
 * */
Route::group('spike',function (){
    Route::get('session','spike.session/index');
    Route::get('goods','spike.goods/index');
    Route::get('goods/read','spike.goods/read');
    Route::post('order/save','spike.order/save');
});

/**
 *
 * 积分路由
 * */
Route::group('integral',function (){
    Route::get('goods','integral.goods/index');
    Route::get('interval','integral.interval/index');
    Route::get('goods/read','integral.goods/read');
    Route::post('order/save','integral.order/save');
});


Route::get('system_config','index/systemConfig');
Route::get('app_version','index/appVersion');


Route::get('/','index/index');

Route::group('goods',function (){
    Route::get('/','goods.goods/index');
    Route::get('/read','goods.goods/read');
    Route::get('/category','goods.category/index');
    Route::get('/info','goods.goods/info');
    Route::get('category_list','goods.category/categoryList');
    Route::get('second_category_list','goods.category/secondCategoryList');
    
});

Route::group('agent',function (){
    Route::get('list','agent.agent/agentList');//全国代理列表
    Route::get('province_agent_list','agent.agent/provinceAgentList');//单独 省下的代理类型
    Route::get('name_list','agent.agent/nameList');//根据代理类型查 城市/区县名称和代理数量
    Route::get('user_list','agent.agent/userList');//代理下的用户列表
    
    Route::post('apply','agent.agent/apply');//申请代理
    Route::post('apply_vip_agent','agent.agent/applyVipAgent');//申请vip代理

    Route::post('wxnotify','agent.trade/wxNotify');
    Route::post('alinotify','agent.trade/aliNotify');
    
});

Route::group('cart',function (){
    Route::post('add','cart.cart/addCart');//添加购物车
    Route::post('modify_num','cart.cart/modifyNum');//修改数量
    Route::post('single_del','cart.cart/singleDelCart');//单个删除
    Route::post('all_del','cart.cart/allDelCart');//全删除
    Route::get('cart_list','cart.cart/cartList');//购物车列表
    Route::post('settlement_cart','cart.cart/settlementCart');//购物车结算
    
    Route::get('test','cart.cart/test');//测试 
});


Route::group('order',function (){
    Route::get('get_pick_point_list','order.order/getPickPointList');//获取自提点
    Route::get('logistics_info','order.order/logisticsInfo');
    Route::get('/','order.order/index');
    Route::post('free','order.order/free');
    Route::get('read','order.order/read');
    Route::get('create','order.order/create');
    Route::post('save','order.order/save');
    Route::post('cart_save_order','order.order/cartSaveOrder');//购物车下单
    Route::get('category','goods.category/index');
    Route::post('order_pay','order.order/orderPay');//订单支付
    
    Route::get('info','goods.goods/info');
    Route::post('trade/wx/notify','order.trade/wxNotify');
    Route::post('trade/ali/notify','order.trade/aliNotify');
});

/**
 * 获取转卖商品
 * */

Route::group('resell',function (){
    Route::get('goods','resell.goods/index');
    Route::get('goods/read','resell.goods/read');
    Route::post('order/save','resell.order/save');
    Route::post('order/trade/wx/notify','resell.trade/wxNotify');
    Route::post('order/trade/ali/notify','resell.trade/aliNotify');
});








